package cn.zwx.distributed.svc.utils;

import cn.zwx.base.enums.ResponseCodeEnum;
import cn.zwx.base.exception.BizWrapException;
import org.springframework.lang.Nullable;

/**
 * @author zhangwenxue
 */
public class AssertUtils {

    public static void isTrue(boolean expression, String message) throws BizWrapException {
        if (!expression) {
            throw new BizWrapException(ResponseCodeEnum.PARAMS_VALID_ERROR.getCode(),message);
        }
    }


    public static void notNull(@Nullable Object object, String message) throws BizWrapException {
        if (object == null) {
            throw new BizWrapException(ResponseCodeEnum.PARAMS_VALID_ERROR.getCode(),message);
        }
    }

}
